import request from '@/utils/request'

export function getMenuTree(params) {
    return request({
        url: `/api/v1/core/menu/tree`,
        method: 'post',
        data: params
    })
}

export function addMenu(params) {
    return request({
        url: `/api/v1/core/menu/add`,
        method: 'post',
        data: params
    })
}

export function updateMenu(params) {
    return request({
        url: `/api/v1/core/menu/update`,
        method: 'post',
        data: params
    })
}

export function deleteMenu(params) {
    return request({
        url: `/api/v1/core/menu/delete?id=${params.id}`,
        method: 'get'
    })
}

export function getMenuRelInterface(params) {
    return request({
        url: `/api/v1/core/menu/rel/interface?menuId=${params.menuId}`,
        method: 'get'
    })
}

export function changeMenuRelInterface(params) {
    return request({
        url: `/api/v1/core/menu/change/menu/rel`,
        method: 'post',
        data: params
    })
}

export function getMenuListByOrgId(params) {
    return request({
        url: `/api/v1/core/menu/list/by/orgId?orgId=${params.orgId}`,
        method: 'get'
    })
}

export function getMenuListByPostId(params) {
    return request({
        url: `/api/v1/core/menu/list/by/postId?postId=${params.postId}`,
        method: 'get'
    })
}

export function getMenuListByUserId(params) {
    return request({
        url: `/api/v1/core/menu/list/by/userId?userId=${params.userId}`,
        method: 'get'
    })
}
